<html>
<head><title>Web Socket Test</title></head>
<script>
    var socket_resource;
    if (window.WebSocket) {
        socket_resource = new WebSocket("ws://localhost:8080/ws?__dew_token__=123");
        socket_resource.onmessage = function (event) {
            console.log("resource saved received : " + JSON.parse(event.data));
        };
        socket_resource.onopen = function (event) {
            console.log("resource saved opened!");
        };
        socket_resource.onclose = function (event) {
            console.log("resource saved closed.");
        };
    } else {
        alert("Your browser does not support Websockets. (Use Chrome)");
    }
    function send() {
        socket_resource.send(JSON.stringify({
            code: "1111",
            name: "aaa",
            enable: true
        }));
    }
</script>
<body>
<input id="btnSend" type="button" value="POST" onclick="send()"/>
</body>
</html>